package com.gjy.concurrency.queue;

import org.junit.jupiter.api.Test;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-05-15 15:25:46
 */
public class QueueTest2 {

    @Test
    public void test1() {
        BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(3);

        queue.add(1);
        queue.add(2);
        queue.add(3);

        Integer peek = queue.peek();
        System.out.println("peek = " + peek);

        if (queue.remove(2)) {
            System.out.println(queue);
        }
    }

}
